perm filename WEBHDR.OLD[TEX,DEK] blob sn#679037 filedate 1982-10-28 generic text, type T, neo UTF8
% standard macros for WEB listings (in addition to PLAIN.TEX)
\def\_{\kern.06em\vbox{\hrule width.3em}} % underline in identifiers
\parskip 0pt % no stretch between paragraphs
\parindent 1em % for paragraphs and for the first line of PASCAL text
\linepenalty 10 % we try to minimize the lines per paragraph

\newfont amr10\is\tenrm % temporary substitutions during font development
\newfont amtt\is\tentt
\newfont ambx10\is\tenbf
\let\mainfont=\tenrm
\textfont0=\tenrm
\rm

\newfont cmr8\is\eightrm
\def\sc{\:\eightrm}
\newfont cmr7 at 14pt \is \titlefont % title on the contents page
\newfont amtt at 15pt \is \ttitlefont % typewriter type in title

\def\\#1{\hbox{\it#1\/\kern.05em}} % italic type for identifiers
\def\|#1{\hbox{$#1$}} % one-letter identifiers look a bit better this way
\def\{\hbox{\bf#1}}		% boldface type for reserved words
\def\.#1{\hbox{\tt		% typewriter type for strings
	\let\\=\BS % backslash in a string
	\let\'=\RQ % right quote in a string
	\let\`=\LQ % left quote in a string
	\let\{=\LB % left brace in a string
	\let\}=\RB % right brace in a string
	\let\↑↑A=\DA % downarrow in a string
	\let\↑↑Z=\NE % neq in a string
	\let\↑↑\=\LE % leq in a string
	\let\↑↑]=\GE % geq in a string
	\let\↑↑X=\LA % leftarrow in a string
	\let\↑↑V=\CX % circle-times sign in a string
	\let\↑↑N=\NF % infinity sign in a string
	\let\↑↑K=\UA % uparrow in a string
	\let\~=\TL % tilde in a string
	\let\ =\SP % space in a string
	\let\_=\UL % underline in a string
	\let\&=\AM % ampersand in a string
	\let\@=\AT % at sign in a string
	\let@=\AT % `bare' at sign in a string
	#1}}
\def\#{\hbox{\tt\char`\#}} % parameter sign
\def\${\ifmmode{\mathchar"27F}\else{\char`\$}} % dollar sign
\def\↑{\ifmmode{\mathchar"222}\else{\char'17}} % caret
\def\~{\ignorespace}

\def\AM{\char'46 } % ampersand character in a string
\def\AT{\char'100 } % at sign in a string
\def\BS{\char'134 } % backslash in a string
\def\CX{\char'26 } % circle-times sign in a string
\def\DA{\char'176 } % downarrow in a string
\def\GE{\spose\UL>} % geq in a string
\def\LA{\char'137 } % leftarrow in a string
\def\LB{\char'173 } % left brace in a string
\def\LE{\spose\UL<} % leq in a string
\def\LQ{\char'15 } % left quote in a string
\def\NE{\spose/=} % neq in a string
\def\NF{\char'25 } % infinity sign in a string
\def\RB{\char'175 } % right brace in a string
\def\RQ{\char'16 } % right quote in a string
\def\SP{\char'40 } % (visible) space in a string
\def\TL{\char'24 } % tilde in a string
\def\UA{\char'136 } % uparrow in a string
\def\UL{\char'32 } % underline character in a string

\newbox\bak \setbox\bak=\hbox to -1em{} % backspace one em
\newbox\bakk\setbox\bakk=\hbox to -2em{} % backspace two ems

\newcount\ind % current indentation in ems
\def\1{\advcount\ind by1\hangindent\count\ind em} % indent one more notch
\def\2{\global\advcount\ind by-1} % indent one less notch
\def\3#1{\hfil\penalty#10\hfilneg} % optional break within a statement
\def\4{\copy\bak} % backspace one notch
\def\5{\hfil\penalty-1\hfilneg\kern2.5em\copy\bakk} % optional break
\def\6{\ifmmode{}\else{\par % forced break
	\hangindent\count\ind em\noindent\kern\count\ind em\copy\bakk}}
\def\7{\Y\6} % forced break and a little extra space

\let\yskip=\smallskip
\def\to{\mathrel{.\,.}} % double dot, used only in math mode
\def\note#1#2.{\Y\noindent{\hangindent2em\baselineskip10pt\:\eightrm#1 #2.\par}}
\def\defin#1{\advcount\ind by 2 \1\&{#1 }} % begin `define' or `format'
\def\A{\note{See also}} % cross-reference for multiply defined module names
\def\B{\mathopen{\.{\@\{}}} % begin controlled comment
\def\C#1{\ifmmode{\gdef\XX{\null$\null}}\else{\gdef\XX{}} % PASCAL comments
	\XX\30\quad$\{\,$#1$\,\}$\XX}
\def\D{\defin{define}} % macro definition
\def\E{\cdot10↑} % exponent in floating point constant
\def\F{\defin{format}} % format definition
\mathchardef\G"3215 % greater than or equal sign
\def\H#1{\hbox{\rm\char'26\tt#1}} % hexadecimal constant
\mathchardef\I"321C % unequal sign
\def\J{\.{\@\&}} % TANGLE's join operation
\mathchardef\K"3220 % left arrow
\mathchardef\L"3214 % less than or equal sign
\outer\def\M#1.{\par\mark{#1}\vfil\penalty-100\vfilneg % beginning of module
	\vskip12ptminus3pt\Q\noindent{\bf#1.\quad}\ignorespace}
\outer\def\N#1.#2.{\par\mark{#1}\vfil\eject % beginning of starred module
	\def\rhead{\uppercase{\ignorespace#2}} % define running headline
	\message{*#1} % progress report
	\write\cont{\Z{#2}{#1}{\the\count0}} % send to contents file
	\Q\noindent{\bf#1.\quad\ignorespace#2.\quad}\ignorespace}
\def\O#1{\hbox{\rm\char'16\kern-.2em\it#1\/\kern.05em}} % octal constant
\def\P{\rightskip=0pt plus 100pt minus 10pt % go into PASCAL mode
	\pretolerance 10000
	\hyphenpenalty 10000
	\exhyphenpenalty 10000
	\setcount\ind=2 \1\ \unskip}
\def\Q{\rightskip=0pt % get out of PASCAL mode
	\pretolerance 200 \hyphenpenalty 50 \exhyphenpenalty 50 }
\mathchardef\R"23A % logical not
\mathchardef\S"3211 % equivalence sign
\def\T{\mathclose{\.{\@\}}}} % terminate controlled comment
\def\U{\note{This code is used in}} % cross-reference for uses of modules
\mathchardef\V"225F % logical or
\mathchardef\W"225E % logical and
\def\X#1:#2\X{\ifmmode{\gdef\XX{\null$\null}}\else{\gdef\XX{}} % module name
	\XX$\langle\,$#2\hbox{\:\eightrm\kern.5em#1}$\,\rangle$\XX}
\def\Y{\par\yskip}
\let\Z=\let % now you can \send the control sequence \Z
\def\){\hbox{\.{\@\$}}} % sign for string pool check sum

\def\lheader{\:\mainfont\the\count0\:\eightrm\qquad\rhead\hfill\title\qquad
	\:\tensy x\:\mainfont\topmark} % top line on left-hand pages
\def\rheader{\:\tensy x\:\mainfont\topmark\:\eightrm\qquad\title\hfill\rhead
	\qquad\:\mainfont\the\count0} % top line on right-hand pages
\def\page{\box255 }
\def\normaloutput#1#2#3{\shipout\vbox{
	\ifeven0{\gdef\place{\moveleft\pageshift\vbox}}
		\else{\gdef\place{\vbox}}
	\place to\fullpageheight{
	\if T\titlepage{\gdef\titlepage{F}}
	\else{\hbox to\pagewidth{\vbox to10pt{}\ifeven0{#2}\else{#3}}}
	\vfill#1}} % parameter #1 is the page itself
	\global\advcount0by1}

\def\titlepage{F} % this puts the header line at the top of the first page
\def\rhead{\.{WEB} OUTPUT} % this running head is reset by starred modules
\def\title{} % an optional title can be set by the user
\def\topofcontents{\ctrline{\:\titlefont\title}
	\vfill} % this material will start the table of contents page
\def\botofcontents{\vfill} % this material will end the table of contents page
\def\contentspagenumber{0} % default page number for table of contents
\def\pagewidth{6.5truein} % the width of each page, can be changed by the user
\def\pageheight{8.7truein} % the height of each page, can be changed by the user
\def\pageshift{.3truein} % shift lefthand pages with respect to righthand ones
\def\fullpageheight{9truein} % page height with running heads, can be changed
\def\setpage{\hsize\pagewidth\vsize\pageheight} % do this if changing page size
\def\contentsfile{CONTENTS} % file that gets table of contents info
\def\readcontents{\input CONTENTS}

\newwrite\cont
\newbox\primethepump
\output{\setbox\primethepump=\page % the first page is garbage
	\openout\cont=\contentsfile
	\global\output{\normaloutput\page\lheader\rheader}}
\hsize 6.5in \vsize 8.7in
\vbox to 8.7in{} % first \topmark won't be null

\def\inx{\par\vskip6pt plus 1fil % we are beginning the index
	\write\cont{} % ensure that the contents file isn't empty
	\closeout\cont % the contents information has been fully gathered
	\newbox\sbox % saved box preceding the index
	\newbox\lbox % lefthand column in the index
	\output{\if T\pagesaved{\normaloutput{\box\sbox}\lheader\rheader}\else{}
		\global\setbox\sbox=\page \gdef\pagesaved{T}}
	\gdef\pagesaved{F} \eject % eject the page-so-far and predecessors
	\setbox\sbox\vbox{\unbox\sbox} % take it out of its box
	\setdimen0=\pageheight \advdimen0 by -1ht\sbox
	\vsize=\dimen0 % the remaining height
	\setdimen0=\pagewidth \advdimen0 by -20pt
	\hsize=.5dm0 % column width for the index (20pt between cols)
	\parfillskip 0pt plus .3dm0 % tries to avoid almost empty lines
	\def\lr{L} % this tells whether the left or right column is next
	\output{\if L\lr{\global\setbox\lbox=\page \gdef\lr{R}}
		\else{\normaloutput{\vbox to\pageheight{\box\sbox\vss
			\hbox to\pagewidth{\box\lbox\hfil\page}}}\lheader\rheader
			\global\vsize\pageheight\gdef\lr{L}}}
	\message{Index:}
	\parskip 0pt plus .5pt
	\outer\def\+##1, {\par\hangindent2em\noindent##1:\kern1em} % index entry
	\def\[##1]{$\underline{##1}$} % underlined index item
	\rm \rightskip0pt plus 2.5em \tolerance 10000
	\hyphenpenalty 10000 \parindent0pt}
\def\fin{\par\vfill\eject % this is done when we are ending the index
	\if L\lr{}\else{\null\vfill\eject} % finish the current page
	\parfillskip 0pt plus 1fil
	\def\rhead{MODULE NAMES}
	\message{Module names:}
	\output{\normaloutput\page\lheader\rheader}
	\setpage
	\def\+{\par\hangindent 2em} }
\def\con{\par\vfill\eject % finish the module names
	\rightskip 0pt \hyphenpenalty 50 \tolerance 200
	\setpage
	\output{\normaloutput\page\lheader\rheader}
	\def\titlepage{T} % prepare to output the table of contents
	\setcount0=\contentspagenumber \def\rhead{TABLE OF CONTENTS}
	\message{Table of contents:}
	\topofcontents
	\line{\hfil Section\hbox to3em{\hss Page}}
	\def\Z##1##2##3{\line{\ignorespace##1
		\leaders\hbox to .5em{.\hfil}\hfil\ ##2\hbox to3em{\hss##3}}}
	\readcontents\relax % read the contents info
	\botofcontents
	\end} % print the contents page(s) and terminate
\tracingstats1 % temporary (during development)